package com.wngbms.homework;

import com.wngbms.homework.bean.*;
import com.wngbms.homework.util.TypeHandlerFactory;
import com.wngbms.service.CustomService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class HomeworkApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(HomeworkApplication.class, args);

        System.out.println(context.getBean(B1.class).getClass().getSimpleName());
        System.out.println(context.getBean(B2.class).getClass().getSimpleName());
        System.out.println(context.getBean(B3.class).getClass().getSimpleName());
//        System.out.println(context.getBean(B4.class).getClass().getSimpleName());
        System.out.println(context.getBean(B5.class).getClass().getSimpleName());
        System.out.println(context.getBean(B6.class).getClass().getSimpleName());
        System.out.println(context.getBean("com.wngbms.homework.bean.B5").getClass().getSimpleName());
        System.out.println(TypeHandlerFactory.getHandler("connectHandler").getClass().getSimpleName());

        CustomService bean = context.getBean(CustomService.class);
        if (bean != null) {
            System.out.println(bean.getOsname() + "\t" + bean.getArch());
        }

    }

}
